/*
 * Copyright (C) 2017 Pingan, Inc. All Rights Reserved.
 */

package com.pingan.haofang.searchcloud.es.schema.type;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * 字段映射
 *
 * @author zhangbi617
 * @date 2017-07-13
 */
public class FieldMapping {
    /**
     * 字段名称
     */
    private String name;

    /**
     * 字段类型
     */
    private String type;

    /**
     * 是否索引
     */
    private boolean indexed = true;

    /**
     * 是否存储
     */
    private boolean stored = true;

    /**
     * 字段设置一个默认值，防止为空 
     */
    private String defaultValue;

    /**
     * 是否是主键
     */
    private boolean uniqueKey = false;

    /**
     * 复制到
     */
    private Set<String> copyTo = new LinkedHashSet<>();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public boolean isIndexed() {
        return indexed;
    }

    public void setIndexed(boolean indexed) {
        this.indexed = indexed;
    }

    public boolean isStored() {
        return stored;
    }

    public void setStored(boolean stored) {
        this.stored = stored;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public Set<String> getCopyTo() {
        return copyTo;
    }

    public void setCopyTo(Set<String> copyTo) {
        this.copyTo = copyTo;
    }

    @Override
    public String toString() {
        return "FieldMapping{" +
                "name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", indexed=" + indexed +
                ", stored=" + stored +
                ", defaultValue='" + defaultValue + '\'' +
                ", copyTo=" + copyTo +
                '}';
    }
}
